﻿<UserControl x:Class="WPFExcelReport.YGRABHM"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                    xmlns:db="clr-namespace:INTEX.DataBase"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"                     
                    FontSize="16"
>
    <UserControl.Resources>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:Divideby10000  x:Key="d10000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <CollectionViewSource   x:Key="vwABPOS" Source="{Binding Path=SetMaster.ABPOS}"/>
        <CollectionViewSource   x:Key="vwMGAAUF" Source="{Binding Path=SetMaster.GAAUF}"/>
        <CollectionViewSource   x:Key="vwGAAUF" Source="{Binding Path=SetDetail.GAAUF}"/>
        <CollectionViewSource   x:Key="vwZUTEI" Source="{Binding Path=SetDetail.ZUTEI}"/>
        <CollectionViewSource   x:Key="vwZUTEIEXT" Source="{Binding Path=SetDetail.ZUTEI_EXT}"/>
        <CollectionViewSource   x:Key="vwARANS" Source="{Binding Path=SetDetail.ARANS}"/>
        <CollectionViewSource   x:Key="vwLRPOS" Source="{Binding Path=SetDetail.LRPOS}"/>
        <CollectionViewSource   x:Key="vwABFOLGE" Source="{Binding Path=SetDetail.ABFOLGE}"/>
        <CollectionViewSource   x:Key="vwMU" Source="{Binding Path=SetDetail.ICC_ABAX}"/>
        <CollectionViewSource   x:Key="vwABAUFM" Source="{Binding Path=SetDetail.ABAUFM}"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto" ></RowDefinition>
            <RowDefinition Height="1*" ></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Name="ZoneHelp" Visibility="Collapsed">
            <TextBlock Text="1.首先必须是已经完成留位的混棉单"/>
            <TextBlock Text="2.选择其中一行混棉单"/>
            <TextBlock Text="3.初始化创建第一个混棉批次"/>
            <TextBlock Text="4.完成之后，可以在分磅单的本批次选择任意一行，执行分盘数和盘量调整"/>
            <TextBlock Text="5.可以指定分盘数和盘量，然后创建出分盘后进行调整"/>
        </StackPanel> 
        <StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
            <WrapPanel Name="ZoneOrder">
                <TextBlock Width="Auto">生产单:</TextBlock>
                <TextBox   Name="txtAUFKRS" MaxLength="2" Width="40" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Pink"  CharacterCasing="Upper" TabIndex="11" />
                <TextBox   Name="txtAUFLFD" MaxLength="6" Width="80" Margin="0,0,0,0"  HorizontalAlignment="Left" KeyUp="txtAUFLFD_KeyUp" />
                <TextBox   Name="txtAUFPOS" MaxLength="6" Width="40" Margin="0,0,0,0"  HorizontalAlignment="Left" />
                <Button  Height="30"  Width="30" Margin="10,0,0,0" Name="btnQuery" Click="btnQuery_Click" KeyboardNavigation.TabIndex="3" IsDefault="True" TabIndex="13">
                    <Button.Background>
                        <ImageBrush ImageSource="Images/Search.png" />
                    </Button.Background>
                </Button>
                <TextBlock FontSize="18"    Width="Auto"  Margin="0,0,0,0" Text="查询" />
                <Grid Margin="20,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"   Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="批量"  VerticalAlignment="Center" />
                    <TextBox Grid.Column="1" Background="White" Height="Auto"    Width="100" Name="txtBatchQty"   Margin="0,0,0,0" Text=""   VerticalAlignment="Center"/>
                </Grid>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0" FontSize="18" Width="30" Height="30" Margin="20,0,0,0"  Name="btnAddBatch" Click="btnAddBatch_Click">
                        <Button.Background>
                            <ImageBrush ImageSource="Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1"  Background="White"   Height="Auto"    Width="Auto"   Margin="0,0,0,0" Text="增加分批"   VerticalAlignment="Center"/>
                </Grid>
            </WrapPanel>
            <WrapPanel>
                <TextBlock   Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="数量"  VerticalAlignment="Center"/>
                <TextBox Background="White"   Height="Auto"   Width="80" CharacterCasing="Upper" Margin="10,0,0,0"  VerticalAlignment="Center"
                                 Text="{Binding Path=ABPSOLLMENGE5, Source={StaticResource ResourceKey=vwABPOS},Converter={StaticResource ResourceKey=d100}}" />

                <Button FontSize="18" Width="30" Height="30" Margin="20,0,0,0"  Name="btnInitializedMU"  Click="btnInitializedMU_Click">
                    <Button.Background>
                        <ImageBrush ImageSource="Images/Refresh.png" />
                    </Button.Background>
                </Button>
                <TextBlock  Background="White"   Height="Auto"    Width="Auto"   Margin="0,0,0,0" Text="初始化"   VerticalAlignment="Center"/>
                <Button FontSize="18" Width="30" Height="30" Margin="20,0,0,0" Name="btnRemoveBatch"    Click="btnRemoveBatch_Click">
                    <Button.Background>
                        <ImageBrush ImageSource="Images/delete.png" />
                    </Button.Background>
                </Button>

                <TextBlock  Background="White"   Height="Auto"    Width="Auto"   Margin="0,0,0,0" Text="删除"   VerticalAlignment="Center"/>
                <Button FontSize="18" Width="30" Height="30" Margin="20,0,0,0" Name="btnRemoveMU"    Click="btnRemoveMU_Click">
                    <Button.Background>
                        <ImageBrush ImageSource="Images/delete.png" />
                    </Button.Background>
                </Button>
                <TextBlock  Background="White"   Height="Auto"    Width="Auto"   Margin="0,0,0,0" Text="根除"   VerticalAlignment="Center"/>
                <Button Content="领料单"    Height="Auto" Margin="20,0,0,0" Width="Auto" Click="btnPrintGB12_Click"   VerticalAlignment="Center"/>
                <Button Content="分磅清单"    Height="Auto" Margin="20,0,0,0" Width="Auto" Click="btnPrintBatches_Click"   VerticalAlignment="Center"/>
            </WrapPanel>
            <WrapPanel>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"></ColumnDefinition>
                        <ColumnDefinition Width="1*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <DataGrid Grid.Column="0" Margin="0,1,0,0" 
                          FontSize="12"
                          CanUserReorderColumns="True"  
                          CanUserResizeRows="True" CanUserSortColumns="True"                  
                          AutoGenerateColumns="False"   
                          EnableRowVirtualization="True"  
                          RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                          IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                          ItemsSource="{Binding Source={StaticResource ResourceKey=vwABPOS}}"   
                  >
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="" Binding="{Binding ABPAUFKRS}" Width="Auto"/>
                            <DataGridTextColumn Header="生产单" Binding="{Binding ABPAUFLFD}" Width="Auto"/>
                            <DataGridTextColumn Header="" Binding="{Binding ABPAUFPOS}" Width="Auto"/>
                            <DataGridTextColumn Header="纱线" Binding="{Binding ABPART}" Width="Auto"/>
                            <DataGridTextColumn Header="版本" Binding="{Binding ABPVAR}" Width="Auto"/>
                            <DataGridTextColumn Header="色号" Binding="{Binding ABPFARBE}" Width="Auto"/>
                            <DataGridTextColumn Header="KG" Binding="{Binding Path=ABPSOLLMENGE5, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                            <DataGridTextColumn Header="开始" Binding="{Binding ABPSTARTDAT}" Width="Auto"/>
                            <DataGridTextColumn Header="交期" Binding="{Binding ABPENDDAT}" Width="Auto"/>
                            <DataGridTextColumn Header="行备注" Binding="{Binding REMARK, Converter={StaticResource ResourceKey=gb2312}}" Width="Auto"/>
                        </DataGrid.Columns>
                    </DataGrid  >
                    <StackPanel Grid.Row="1" Grid.Column="1">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"></RowDefinition>
                                <RowDefinition Height="1*"></RowDefinition>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0">
                                <WrapPanel>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="ID"  VerticalAlignment="Center" />
                                        <TextBlock Grid.Column="1" Background="White"   Height="Auto"    Width="40" Text="{Binding Path=GAPOS, Source={StaticResource ResourceKey=vwGAAUF}}"  Margin="15,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="MU"  VerticalAlignment="Center" />
                                        <TextBlock Grid.Column="1" Background="White"   Height="Auto"    Width="40" Text="{Binding Path=GAAUFMSL, Source={StaticResource ResourceKey=vwGAAUF}}"  Margin="15,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="纱线"  VerticalAlignment="Center" />
                                        <TextBox Grid.Column="1" Background="White"   Height="Auto"    Width="100" Text="{Binding Path=GAART, Source={StaticResource ResourceKey=vwGAAUF},Converter={StaticResource ResourceKey=Trim}}"  Margin="1,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="版本"  VerticalAlignment="Center" />
                                        <TextBox Grid.Column="1" Background="White"   Height="Auto"    Width="40" Text="{Binding Path=GAVAR, Source={StaticResource ResourceKey=vwGAAUF}}"  Margin="0,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="色号"  VerticalAlignment="Center" />
                                        <TextBox Grid.Column="1" Background="White"   Height="Auto"    Width="100" Text="{Binding Path=GAFARBE,Converter={StaticResource ResourceKey=gb2312}, Source={StaticResource ResourceKey=vwGAAUF}}"  Margin="0,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                </WrapPanel>
                                <WrapPanel>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="比列"  VerticalAlignment="Center" />
                                        <TextBox Grid.Column="1" Background="White"   Height="Auto"    Width="80" Text="{Binding Path=GABASMG2,Converter={StaticResource ResourceKey=d1000},  Source={StaticResource ResourceKey=vwGAAUF}}"  Margin="15,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <Button  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Content="计算"  VerticalAlignment="Center" Click="Calculate_Click" />
                                        <TextBlock Grid.Column="1" Background="White"   Height="Auto"    Width="80" Text="{Binding Path=GAKG1,Converter={StaticResource ResourceKey=d100},  Source={StaticResource ResourceKey=vwGAAUF}}"  Margin="15,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <Button Grid.Column="0" FontSize="18" Width="30" Height="30" Margin="20,0,0,0"  Click="btnAddGAAUF_Click">
                                            <Button.Background>
                                                <ImageBrush ImageSource="Images/Add.png" />
                                            </Button.Background>
                                        </Button>
                                        <TextBlock Grid.Column="1"  Background="White"   Height="Auto"    Width="Auto"   Margin="0,0,0,0" Text="增加原料"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Button Grid.Column="0" FontSize="18" Width="30" Height="30" Margin="0,0,0,0"   Click="btnSaveGAAUF_Click">
                                        <Button.Background>
                                            <ImageBrush ImageSource="Images/save.png" />
                                        </Button.Background>
                                    </Button>
                                    <Button FontSize="18" Width="30" Height="30" Margin="20,0,0,0"     Click="btnDelGAAUF_Click">
                                        <Button.Background>
                                            <ImageBrush ImageSource="Images/delete.png" />
                                        </Button.Background>
                                    </Button>
                                </WrapPanel>
                                <WrapPanel>
                                    <Grid  Margin="0,0,0,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="总比列"  VerticalAlignment="Center" />
                                        <TextBlock Grid.Column="1" Background="White"  FontSize="18" Height="Auto"    Width="40" Name="txtTRatio"   Margin="15,0,0,0" Text="0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="批次"  VerticalAlignment="Center" />
                                        <TextBox Grid.Column="1" Background="White"  Text="{Binding Path=GABEM,Converter={StaticResource ResourceKey=Trim},  Source={StaticResource ResourceKey=vwGAAUF}}"  Height="Auto"    Width="100"     Margin="15,0,0,0"   VerticalAlignment="Center"/>
                                    </Grid>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <Button Grid.Column="0" FontSize="18" Width="30" Height="30" Margin="20,0,0,0"  Click="btnToAllocation_Click">
                                            <Button.Background>
                                                <ImageBrush ImageSource="Images/Convert.png" />
                                            </Button.Background>
                                        </Button>
                                        <TextBlock Grid.Column="1"  Background="White"   Height="Auto"    Width="Auto"   Margin="0,0,0,0" Text="转至制条需求"   VerticalAlignment="Center"/>
                                    </Grid>
                                </WrapPanel>
                            </StackPanel>
                            <DataGrid  Grid.Row="1" Margin="0,1,0,0" 
                              FontSize="12"
                              CanUserReorderColumns="True"  
                              CanUserResizeRows="True" CanUserSortColumns="True"                  
                              AutoGenerateColumns="False"   
                              EnableRowVirtualization="True"  
                              RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                              IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwGAAUF}}"  x:Name="dlgABP" 
                              >
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="类型" Binding="{Binding GAAUFMSL}" Width="Auto"/>
                                    <DataGridTextColumn Header="纱线" Binding="{Binding GAART, Converter={StaticResource ResourceKey=gb2312}}" Width="Auto"/>
                                    <DataGridTextColumn Header="版本" Binding="{Binding GAURVAR}" Width="Auto"/>
                                    <DataGridTextColumn Header="版本" Binding="{Binding GAVAR}" Width="Auto"/>
                                    <DataGridTextColumn Header="色号" Binding="{Binding GAFARBE, Converter={StaticResource ResourceKey=gb2312}}" Width="Auto"/>
                                    <DataGridTextColumn Header="批次" Binding="{Binding Path=GABEM, Converter={StaticResource ResourceKey=Trim}}" Width="Auto"/>
                                    <DataGridTextColumn Header="比例" Binding="{Binding Path=GABASMG2, Converter={StaticResource ResourceKey=d1000}}" Width="Auto"/>
                                    <DataGridTextColumn Header="需求" Binding="{Binding Path=GAKG1, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                    <DataGridTextColumn Header="预留" Binding="{Binding Path=GAKG2, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                    <DataGridTextColumn Header="留位" Binding="{Binding Path=GAKG3, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                    <DataGridTextColumn Header="发货" Binding="{Binding Path=GAKG5, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                                    <DataGridTextColumn Header="开始" Binding="{Binding GADATBIS}" Width="Auto"/>
                                </DataGrid.Columns>
                            </DataGrid  >
                        </Grid>
                    </StackPanel>

                </Grid>

            </WrapPanel>
        </StackPanel>
        <Grid Grid.Row="2"   Grid.ColumnSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="1*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"></ColumnDefinition>
                <ColumnDefinition Width="1*" />
            </Grid.ColumnDefinitions>
            <StackPanel     Grid.ColumnSpan="2"  >
                <WrapPanel>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock  Grid.Column="0" Height="Auto"   Width="Auto"  Margin="20,0,0,0" Text="盘号:"  VerticalAlignment="Center" />
                        <TextBlock  Grid.Column="1"   Background="LightCyan"  FontSize="18" Height="Auto"    Width="60"     Margin="15,0,0,0"  
                                   Text="{Binding Path=ABAAPOS, Source={StaticResource ResourceKey=vwMU}}" 
                                   VerticalAlignment="Center"  />
                    </Grid>
                    <Grid  Margin="20,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock  Grid.Column="0"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="盘数"  VerticalAlignment="Center"/>
                        <TextBox Grid.Column="1" Background="White"  FontSize="18" Height="Auto"    Width="60" Name="txtBatches"   Margin="15,0,0,0" Text="0"   VerticalAlignment="Center"/>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button Grid.Column="0" FontSize="18" Width="30" Height="30" Margin="0,0,0,0"  Name="btnSaveBatch" Click="btnSaveBatch_Click">
                            <Button.Background>
                                <ImageBrush ImageSource="Images/save.png" />
                            </Button.Background>
                        </Button>
                        <TextBlock Grid.Column="1" Background="White"   Height="Auto"    Width="Auto"   Margin="0,0,0,0" Text="分盘"   VerticalAlignment="Center"/>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock   Grid.Column="0"   Height="Auto"   Width="Auto"  Margin="20,0,0,0" Text="单成份量:"   VerticalAlignment="Center"/>
                        <TextBox   Grid.Column="1" Background="White"  FontSize="18" Height="Auto"    Width="60" Name="txtLeftQty"   Margin="0,0,0,0" Text="{Binding ABARESMG, Converter={StaticResource ResourceKey=d1000}, Source={StaticResource ResourceKey=vwMU}}"   VerticalAlignment="Center"/>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button   Grid.Column="0"  FontSize="18" Width="30" Height="30" Margin="0,0,0,0"   Click="btnManualSetQty_Click">
                            <Button.Background>
                                <ImageBrush ImageSource="Images/Refresh.png" />
                            </Button.Background>
                        </Button>
                        <TextBlock     Grid.Column="1"  Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="刷新"   VerticalAlignment="Center"/>
                    </Grid>
                </WrapPanel>
            </StackPanel>
            <DataGrid Grid.Row="1" Grid.Column="0" Margin="0,1,0,0" 
                              FontSize="12"
                                      Grid.RowSpan="2"  
            CanUserReorderColumns="True"  
                  CanUserResizeRows="True" CanUserSortColumns="True"                  
                  AutoGenerateColumns="False"   
                  EnableRowVirtualization="True"  
                  RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                  IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                  ItemsSource="{Binding Source={StaticResource ResourceKey=vwZUTEIEXT}}"  
                              Name="dlgZUTEIEXT"
                  >
                <DataGrid.Columns>
                    <DataGridTextColumn Header="" Binding="{Binding ZUAUFKRS}" Width="Auto"/>
                    <DataGridTextColumn Header="生产单" Binding="{Binding ZUAUFLFD}" Width="Auto"/>
                    <DataGridTextColumn Header="" Binding="{Binding ZUAUFPOS}" Width="Auto"/>
                    <DataGridTextColumn Header="类型" Binding="{Binding ZUSA}" Width="Auto"/>
                    <DataGridTextColumn Header="批次" Binding="{Binding ZUSPPART}" Width="Auto"/>
                    <DataGridTextColumn Header="品种" Binding="{Binding ZUART}" Width="Auto"/>
                    <DataGridTextColumn Header="版本" Binding="{Binding ZUVAR}" Width="Auto"/>
                    <DataGridTextColumn Header="色号" Binding="{Binding ZUFARBE}" Width="Auto"/>
                    <DataGridTextColumn Header="单元" Binding="{Binding ZULBEHI}" Width="Auto"/>
                    <DataGridTextColumn Header="KG" Binding="{Binding Path=ZUEINTKG, Converter={StaticResource ResourceKey=d10000}}" Width="Auto"/>
                </DataGrid.Columns>
            </DataGrid  >
            <DataGrid Grid.Row="1" Grid.Column="0" Margin="0,1,0,0" 
                              FontSize="12"
                                      Grid.RowSpan="2"  
            CanUserReorderColumns="True"  
                  CanUserResizeRows="True" CanUserSortColumns="True"                  
                  AutoGenerateColumns="False"   
                  EnableRowVirtualization="True"  
                  RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                  IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                  ItemsSource="{Binding Source={StaticResource ResourceKey=vwZUTEI}}"  
                              Name="dlgZUTEI"
                  >
                <DataGrid.Columns>
                    <DataGridTextColumn Header="" Binding="{Binding ZUAUFKRS}" Width="Auto"/>
                    <DataGridTextColumn Header="生产单" Binding="{Binding ZUAUFLFD}" Width="Auto"/>
                    <DataGridTextColumn Header="" Binding="{Binding ZUAUFPOS}" Width="Auto"/>
                    <DataGridTextColumn Header="类型" Binding="{Binding ZUSA}" Width="Auto"/>
                    <DataGridTextColumn Header="批次" Binding="{Binding ZUSPPART}" Width="Auto"/>
                    <DataGridTextColumn Header="品种" Binding="{Binding ZUART}" Width="Auto"/>
                    <DataGridTextColumn Header="版本" Binding="{Binding ZUVAR}" Width="Auto"/>
                    <DataGridTextColumn Header="色号" Binding="{Binding ZUFARBE}" Width="Auto"/>
                    <DataGridTextColumn Header="单元" Binding="{Binding ZULBEHI}" Width="Auto"/>
                    <DataGridTextColumn Header="留位量" Binding="{Binding Path=ZUEINTKG, Converter={StaticResource ResourceKey=d1000}}" Width="Auto"/>
                </DataGrid.Columns>
            </DataGrid  >
            <DataGrid Grid.Row="1"    Grid.Column="1"  Margin="0,1,0,0" 
                              FontSize="12"
                              CanUserReorderColumns="True"  
                              CanUserResizeRows="True" CanUserSortColumns="True"                  
                              AutoGenerateColumns="False"   
                              EnableRowVirtualization="True"  
                              RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                              IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                              ItemsSource="{Binding Source={StaticResource ResourceKey=vwMU}}"  x:Name="dlgABA" 
                              >
                <DataGrid.Columns>

                    <DataGridTextColumn Header="批次" Binding="{Binding ABAAPOS,Converter={StaticResource ResourceKey=pnum}}" Width="Auto"/>
                    <DataGridTextColumn Header="" Binding="{Binding ABAAUFKRS}" Width="Auto"/>
                    <DataGridTextColumn Header="分盘" Binding="{Binding ABAAUFLFD}" Width="Auto"/>
                    <DataGridTextColumn Header="" Binding="{Binding ABAAUFPOS}" Width="Auto"/>
                    <DataGridTextColumn Header="纱线" Binding="{Binding ABPART}" Width="Auto"/>
                    <DataGridTextColumn Header="色号" Binding="{Binding ABPFARBE}" Width="Auto"/>
                    <DataGridTextColumn Header="盘量" Binding="{Binding ABAVKART,Converter={StaticResource ResourceKey=d1000 }}" Width="Auto"/>
                    <DataGridTextColumn Header="盘数" Binding="{Binding ABAVKFARBE}" Width="Auto"/>
                    <DataGridTextColumn Header="总重" Binding="{Binding ABARESMG,Converter={StaticResource ResourceKey=d1000 }}" Width="Auto"/>
                </DataGrid.Columns>
            </DataGrid  >
        </Grid>
    </Grid>
</UserControl>
